<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>简介</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="book.parle.html">« Parle</a></li>
      <li style="float: right;"><a href="parle.setup.html">安装/配置 »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.parle.html">Parle</a></li>
    <li>简介</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="intro.parle" class="preface">
  <h1 class="title">简介</h1>
  <p class="para">
   The parle extension provides general purpose lexing and parsing facilities. The implementation is based on <a href="http://www.benhanson.net/" class="link external">&raquo;&nbsp;Ben Hanson</a>&#039;s libraries and requires a <a href="http://en.cppreference.com/w/cpp/compiler_support" class="link external">&raquo;&nbsp;C++14</a> capable compiler. The lexer is based on the regex matching, the parser is LALR(1). Lexers and parsers are generated on the fly and can be used immediately after they&#039;ve been finalized. Parle deals with parsing and lexing, the appropriate data structures representation and processing are the implementer&#039;s task. Serialization and code generation are not supported by the extension, yet.
  </p>
  <p class="para">
   Lexer analysis is a process of splitting a character sequence into a list of lexemes. The lexeme list can be then used for the syntax analysis against a formal grammar. These operations are also known as lexing and parsing. This documentation doesn&#039;t aim to provide an exhaustive information on lexing and parsing. Good information in this regard is available on the numerous resources on the net. Several usage examples are included, to show the functionality. The extension is useful for PHP programmers both willing to learn or to utilize parsing and lexing. State machines and grammar parsing don&#039;t have to be implemented manually, these complex tasks are taken away by parle. Thanks to that, the development can be focused on the actual problem solving.
  </p>
  <p class="para">  
   The common use case for parle is, when a data format is too complex to be handled by the regex matching with PCRE. The practical application is herewith wide. Be it a specific data format, a behavior modification of existing functions, even an own programming language and beyond. The helper methods such as <span class="methodname"><a href="parle-lexer.dump.html" class="methodname">Parle\Lexer::dump()</a></span> to inspect the generated state machine, or <span class="methodname"><a href="parle-parser.dump.html" class="methodname">Parle\Parser::dump()</a></span> to inspect the generated grammar, are useful. The method <span class="methodname"><a href="parle-parser.trace.html" class="methodname">Parle\Parser::trace()</a></span> can also be used to track the parsing operation.
  </p>
 </div></div></div></body></html>